package cn.car;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import org.apache.log4j.Logger;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

public class SysInit extends HttpServlet {

	private static final long serialVersionUID = 4210064036224698666L;
	
	private static Logger logger = Logger.getLogger(SysInit.class);
	
	public SysInit() {
		super();
	}
	
	public void destroy() {
		super.destroy(); 
	}
	
	@Override
	public void init() throws ServletException {
		logger.info("开始加载Spring配置");
        ApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(this.getServletContext());
        ServiceLocator.init(ctx);
        logger.info("成功加载Spring配置");
	}

}
